package com.henry.controller;


import com.henry.result.R;
import com.henry.service.SmsService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @description sms 前端控制器
 * @author Henry Guan
 * @since 2023-08-19
 */
@RestController
@RequestMapping("/admin/sms")
public class SmsController {

    @Resource
    private SmsService smsService;


    @PostMapping("/sendCode/{phone}")
    public R sendCode(@PathVariable String phone){
        boolean flag = smsService.sendCode(phone);
        if (flag) {
            return R.ok();
        } else {
            return R.error();
        }
    }
}
